Stepper Motor
1.Permanent magnet (PM) stepper motor
2.Variable reluctance (VR) stepper motor
3.Hybrid Synchronous stepper motor
1.Unipolar Stepper motor
2. Bipolar Stepper motor
A4988 Stepper Driver
Pin Configuration of A4988
NodeMCU
Pin Configuration of NodeMCU
const int stepPin = D2;
const int dirPin = D1;
void setup() {
pinMode(stepPin,OUTPUT);
pinMode(dirPin,OUTPUT);
}
void loop() {
digitalWrite(dirPin,HIGH); // SETS THE MOTOR CLOCK-WISE DIRECTION
for(int x = 0; x < 200; x++) { // GENERATING 200 PULSES FROM THE CONTROLLER FOR COMPLETE CYCLE
digitalWrite(stepPin,HIGH);
delayMicroseconds(500);
digitalWrite(stepPin,LOW);
delayMicroseconds(500);
}
delay(1000);
digitalWrite(dirPin,LOW); // SETS ANTI-CLOCKWISE DIRECTION
for(int x = 0; x < 200; x++) { // GENERATING 200 PULSES FROM THE CONTROLLER FOR COMPLETE CYCLE
digitalWrite(stepPin,HIGH);
delayMicroseconds(500);
digitalWrite(stepPin,LOW);
delayMicroseconds(500);
}
delay(1000);
}